module.exports = function ($resource, $state, $http, $q, FileUploader, toaster) {

	return {
		restrict: 'AE',
		template: require('../views/productEntityInfo.html'),
		replace: true,
		scope: {
			'saleobj': '=',
			'util': '=',
		},
		link: function (scope, elements, attrs){
			scope.tabledata = [];

			function getEntityInfo() {
				$resource('/api/as/tc/ticketsalesku/getSaleEntityInfo', {}, {})
				  .save({'sale_code':scope.saleobj.code}, function(res){
					if (res.errcode != 0) {
						toaster.error({ title: '', body: '获取产品规格信息失败'});
						return;
					}
					console.log(res.data);
					scope.entity = res.data;
					var temp = scope.entity.entity_label + ',' + scope.entity.entity_label_custom;
					scope.entity.entity_labels = temp.split(',');

				});
			}
			getEntityInfo();
			


		}

	};
};

